<?php
/**
 * @file name : sitemap.php
 * @package   : tthokim
 * @author    : Vo Thanh Minh
 * @email     : <thanhminhld@yahoo.com - thanhminhld@gmail.com>
 * @copyright : 2011
 *
 */
if (!defined('BASEPATH')) {
    exit('No direct script access');
}

class Sitemap extends Base_Controller
{
    /**
     * __construct
     * @access public
     * @param
     * @return
     */
    public function __construct()
    {
        parent::__construct();
    }
    /**
      * _remap
      * @access public
      * @param
      * @return
      */
    public function _remap( $method )
    {
        switch ($method) {

            case 'add':
            case 'edit':
                break;

            default:
                $this->index();
        }
    }
    /**
     * @function index
     * @access     private
     * @param
     * @return
     */
    private function index()
    {
        $controlName = $this->uri->segment(1);

        $data = array('urlControlName'  => '?c=' . $controlName);
        /*
        $config = &get_config();

        $arrWhere = array('lang_id' => $this->lang_default);
        $arrModel = array('services_model'   => array('parentUrl'      => $config['base_url']
                                                                          . 'services/services-category/SC-',
                                                      'parentCss'      => 'class="childmenu"',
                                                      'childCss'       => 'class="childsubmenu"'),

                          'products_model'   => array('parentUrl'      => $config['base_url']
                                                                          . 'products/products-category/PC-',
                                                      'parentCss'      => 'class="childmenu"',
                                                      'childCss'       => 'class="childsubmenu"'),

                          'news_model'       => array('parentUrl'      => $config['base_url']
                                                                          . 'news/news-category/NC-',
                                                      'parentCss'      => 'class="childmenu"',
                                                      'childCss'       => 'class="childsubmenu"'),

                          'consultant_model' => array('parentUrl'      => $config['base_url']
                                                                          . 'consultant/consultant-category/CC-',
                                                      'parentCss'      => 'class="childmenu"',
                                                      'childCss'       => 'class="childsubmenu"')
                          );
        $generalArr = array();
        foreach ($arrModel as $model => $url) {
            $arrCategory = $this->$model->loadList($arrWhere, 'all', 0, 'category_id', 'ASC');
            $arrCategory = array2ParentChildStructor($arrCategory, 'parent_id', 0, $url);
            print_r($arrCategory); echo "\n";
            array_push($generalArr, $arrCategory);
        }
        $strSiteMap = '';
        foreach ($generalArr as $key => $arrMenu) {
            if ($key == 0) {
                $strSiteMap .= '<ul class="ul_none">'
                            .  '<li class="li_none">&nbsp;</li>'
                            .  '<li class="li_space">&nbsp;</li>'
                            .  '<li class="li_none">&nbsp;</li>'
                            .  '<li class="li_space">&nbsp;</li>';
            }
        }
        */
        $this->msmarty->assignArrVal($data);

        //$this->msmarty->fetch($controlName . '/sitemap.tpl');
        $this->msmarty->display($controlName . '/sitemap.tpl');
    }
}
?>
